import Vue from 'vue'
import VueRouter from 'vue-router'
import routes from './router/router'

import store from './store/'
import {routerMode} from './assets/config/env'
import './assets/config/rem'
import FastClick from 'fastclick'
import 'vant/lib/index.css';
import './assets/style/iconfont/iconfont.css';
// import { Cell, CellGroup, Button,DatetimePicker,Picker,Field,Checkbox,CheckboxGroup ,Icon,Uploader,Dialog,Radio,RadioGroup,ImagePreview,Overlay,Loading,Toast,List,NumberKeyboard } from 'vant';
import Vant from 'vant';
import VueAMap from 'vue-amap'
import md5 from 'js-md5';
import axios from 'axios';
import echarts from 'echarts';
Vue.prototype.$echarts = echarts;
Vue.use(Vant);
// Vue.use(VueAMap);
// VueAMap.initAMapApiLoader({
// 	key: '180bd764414e2e760e99e7fab97c0e77',
// 	//key: '8eeb55bd7787113738c5eec977d2c409',
// 	plugin: ['Autocomplete', 'PlaceSearch', 'Scale', 'OverView', 'ToolBar', 'MapType', 'PolyEditor', 'AMap.CircleEditor','Geolocation']
//   });
// Vue.use(Cell).use(CellGroup).use(Button).use(DatetimePicker).use(Picker).use(Field).use(Checkbox).use(CheckboxGroup).use(Icon).use(Uploader).use(Dialog).use(Radio).use(RadioGroup).use(ImagePreview).use(Overlay).use(Loading).use(Toast).use(List).use(NumberKeyboard);
/*if ('addEventListener' in document) {
    document.addEventListener('DOMContentLoaded', function() {
        FastClick.attach(document.body);
    }, false);
}*/
Vue.prototype.$md5 = md5;
Vue.prototype.axios = axios;
Vue.use(VueRouter);
const router = new VueRouter({
	routes,
	mode: routerMode,
	strict: process.env.NODE_ENV !== 'production',
	scrollBehavior (to, from, savedPosition) {
	    if (savedPosition) {
		    return savedPosition
		} else {
			if (from.meta.keepAlive) {
				from.meta.savedPosition = document.body.scrollTop;
			}
		    return { x: 0, y: to.meta.savedPosition || 0 }
		}
	}
})

new Vue({
	router,
	store,
}).$mount('#app')

// 判断网络状态
window.addEventListener("offline",function(e){
alert('网络中断,请检查网络！')
})
